//
//  ViewController.m
//  TestForRequest
//
//  Created by admin on 2021/2/26.
//

#import "ViewController.h"

#import "ShellRequest.h"
#import "SShellRequest.h"

#import "ShellAPIResponse.h"


@interface ViewController ()
@property(nonatomic, strong)ShellRequest * request;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
//    ShellRequest * request = [[ShellRequest alloc] init];

    ShellRequest * request = [[ShellRequest alloc] init];
    
    request.shellSuccessblock(^(__kindof ShellAPIResponse * _Nullable response) {
        NSLog(@"ShellRequest~~~~~~~~~%@, %@", response.returnCode, response.returnMessage);
    })
    .shellFailureblock(^(__kindof ShellAPIResponse * _Nullable response) {
        NSLog(@"ShellRequestXXXXXXXXXXXXXXX%@", response.returnCode);
    })
    .requestUrlBlock(^NSString * _Nullable{
        return @"/mock/route/to/shell";
    })
    .requestArgumentBlock(^id _Nullable{
        return (id)@{};
    })
    .requestMethodBlock(^YTKRequestMethod{
        return YTKRequestMethodGET;
    });
    
    request.startBlock();
    
    SShellRequest * ssRequest = [[SShellRequest alloc]init];
    
    ssRequest.requestUrlBlock(@"/mock/route/to/shell")
    .shellSuccessblock(^(__kindof ShellAPIResponse * _Nullable response) {
        NSLog(@"SShellRequest~~~~~~~~~%@, %@", response.returnCode, response.returnMessage);
    })
    .shellFailureblock(^(__kindof ShellAPIResponse * _Nullable response) {
        NSLog(@"SShellRequestXXXXXXXX%@", response.returnCode);

    })
    .requestArgumentBlock(@{})
    .requestMethodBlock(YTKRequestMethodGET)
    .startBlock();
    
}

@end
